<?php

namespace Common\TagLib;
use Think\Template\TagLib;

/**
* 首页幻灯标签
*/
class Slide extends TagLib
{
	//标签定义
	protected $tags = array(
		'list' => array('attr' => 'limit,order'),
	);

	public function _list($tag, $content) {
		$limit = empty($tag['limit']) ? 4 : $tag['limit'];
		$str = <<<str
<?php
    \$list = M('Slide')->limit($limit)->order("{$tag['order']}")->select();
    foreach (\$list as \$v) :
?>
str;
        $str .= $content;
        $str .= "<?php endforeach;?>";
        return $str;
	}
}